In this notebook wi will explore ghg emissions data published from world bank.
Let’s identify datasets related to ghg emissions
library(WDI)
new_wdi_cache <- WDIcache()
datasets = WDIsearch("*emissions.", cache = new_wdi_cache)
print(head(datasets))
## indicator
## [1,] "EE.BOD.CGLS.ZS"
## [2,] "EE.BOD.CHEM.ZS"
## [3,] "EE.BOD.FOOD.ZS"
## [4,] "EE.BOD.MTAL.ZS"
## [5,] "EE.BOD.OTHR.ZS"
## [6,] "EE.BOD.PAPR.ZS"
## name
## [1,] "Water pollution, clay and glass industry (% of total BOD emissions)"
## [2,] "Water pollution, chemical industry (% of total BOD emissions)"
## [3,] "Water pollution, food industry (% of total BOD emissions)"
## [4,] "Water pollution, metal industry (% of total BOD emissions)"
## [5,] "Water pollution, other industry (% of total BOD emissions)"
## [6,] "Water pollution, paper and pulp industry (% of total BOD emissions)"
data = WDI(indicator=c("wb_total_ghg_emissions" = "EN.ATM.GHGT.KT.CE"))
print(head(datasets))
## indicator
## [1,] "EE.BOD.CGLS.ZS"
## [2,] "EE.BOD.CHEM.ZS"
## [3,] "EE.BOD.FOOD.ZS"
## [4,] "EE.BOD.MTAL.ZS"
## [5,] "EE.BOD.OTHR.ZS"
## [6,] "EE.BOD.PAPR.ZS"
## name
## [1,] "Water pollution, clay and glass industry (% of total BOD emissions)"
## [2,] "Water pollution, chemical industry (% of total BOD emissions)"
## [3,] "Water pollution, food industry (% of total BOD emissions)"
## [4,] "Water pollution, metal industry (% of total BOD emissions)"
## [5,] "Water pollution, other industry (% of total BOD emissions)"
## [6,] "Water pollution, paper and pulp industry (% of total BOD emissions)"
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
emission_FR <- data %>% filter(iso2c == "FR")
emission_USA <- data %>% filter(iso2c == "US")
library(plotly)
## Loading required package: ggplot2
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
fig <- plot_ly(emission_FR, x = ~year, y = ~wb_total_ghg_emissions,
type = 'scatter', mode = 'lines')
fig